<style lang="scss">
  @import "../../utils/base.scss";
</style>
<template>
  <div class="quest_content">
    <div class="gcontent">
      <Form ref="childrenInfo" :model="childrenInfo" :rules="childrenValidate" :label-width="labelWidth" label-position="right"
        class="form form_left">
        <Row v-if="reqId != null && reqId != ''">
          <Col span="8">
          <FormItem label="工单ID：">
            <Input v-model="reqId" :readonly="ifedit" />
          </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="8">
          <FormItem label="工单标题：" prop="reqSubject">
            <Input v-model="childrenInfo.reqSubject" :readonly="ifedit" />
          </FormItem>
          </Col>
        </Row>
        <!-- 资源 -->
        <Row v-if="(type === '_07sonresource' || isEdit == 16 || dataInfo.resourceList.length > 0) && dataInfo.resourceList.length > 0">
          <Col span="22" style="width:96.57%;padding-bottom: 10px;">
          资源服务：
          </Col>
          <Col span="24" style="width: 96.666667%;padding-bottom: 10px;padding-left: 20px">
          <Table @on-selection-change="checkResourceList" border :span-method="handleSpan" ref="selection" :columns="ifedit?columns.resourceColumns1:columns.resourceColumns"
            :data="dataInfo.resourceList">
            <template slot-scope="{ row, index }" slot="clazz">
              <span>{{row.clazz.split(".").length > 1 ? row.clazz.split(".")[1]:row.clazz}}</span>
            </template>
            <template slot-scope="{ row, index }" slot="serviceName">
              <span>{{row.serviceName.split(".").length > 1 ? row.serviceName.split(".")[1]:row.serviceName}}</span>
              <Tooltip v-if="row.subName == null || row.subName == ''" :content="row.des === undefined || row.des === null || row.des === '' ? '暂无信息':row.des"
                max-width="200" placement="right" :transfer="true" style="white-space: normal;">
                <Icon type="md-help-circle" />
              </Tooltip>
            </template>
            <template slot-scope="{ row, index }" slot="subName">
              <span>{{row.subName.split(".").length > 1 ? row.subName.split(".")[1]:row.subName}}</span>
              <Tooltip v-if="row.subName != null && row.subName != ''" :content="row.des === undefined || row.des === null || row.des === '' ? '暂无信息':row.des"
                max-width="200" placement="right" :transfer="true" style="white-space: normal;">
                <Icon type="md-help-circle" />
              </Tooltip>
            </template>
            <template slot-scope="{ row, index }" slot="options">
              <!-- 默认 -->
              <Row v-if="row.resourcetype == 0">
                <Col span="12" class="col_info">
                <span>*数量：{{row.val}}</span>
                </Col>
                <Col span="12" class="col_info">
                <span>*单位：{{row.unit}}</span>
                </Col>
              </Row>
              <!-- 单选 -->
              <Row v-else-if="row.resourcetype == 1">
                <Col span="24" class="col_info" style="text-align: center;">
                <span>{{row.val}}</span>
                </Col>
              </Row>
              <!-- 文本框 -->
              <Row v-else-if="row.resourcetype == 3">
                <template v-for="(item, key) in row.options">
                  <Col span="22" :key="key">
                  <span>*{{item}}：{{row.val}}</span>
                  </Col>
                </template>
              </Row>
              <!-- 多选 -->
              <Row v-else-if="row.resourcetype == 4">
                <Col span="24">
                <CheckboxGroup v-model="row.val">
                  <Checkbox v-for="(item,index) in row.options" :key="index" :label="item" :disabled="true">{{item}}</Checkbox>
                </CheckboxGroup>
                </Col>
              </Row>
              <!-- 双副本 -->
              <Row v-if="row.resourcetype == 5">
                <Col span="12" class="col_info">
                <span>*双副本数量：{{row.val}}</span>
                </Col>
                <Col span="11" class="col_info">
                <span>*单位：{{row.unit}}</span>
                </Col>
                <Col span="12" class="col_info">
                <span>*单副本数量：{{row.val/2}}</span>
                </Col>
              </Row>
              <!-- 三副本 -->
              <Row v-if="row.resourcetype == 6">
                <Col span="12" class="col_info">
                <span>*三副本数量：{{row.val}}</span>
                </Col>
                <Col span="11" class="col_info">
                <span>*单位：{{row.unit}}</span>
                </Col>
                <Col span="12" class="col_info">
                <span>*单副本数量：{{parseFloat(row.val/3).toFixed(2)}}</span>
                </Col>
              </Row>
            </template>
            <template slot-scope="{ row, index }" slot="quantity2">
              <span v-if="row.resourcetype == 1 || row.resourcetype == 3 || row.resourcetype == 4">{{row.waitQuantity == 0 && row.records != null && row.records.length > 0 ? '已分配': '未分配'}}</span>
              <template v-else>
                <template v-if="row.waitQuantity == 0">已分配完</template>
                <InputNumber v-else :min="0" :max="row.waitQuantity" style="width: 80%; " class="table_input" v-model="dataInfo.resourceList[index].quantity2"
                  :readonly="ifedit" />
              </template>
            </template>
            <template slot-scope="{ row, index }" slot="doneQuantity">
              <span v-if="row.resourcetype == 1 || row.resourcetype == 3 || row.resourcetype == 4">——</span>
              <span v-else>{{parseFloat(row.doneQuantity).toFixed(2)}}</span>
            </template>
            <template slot-scope="{ row, index }" slot="doingQuantity">
              <span v-if="row.resourcetype == 1 || row.resourcetype == 3 || row.resourcetype == 4">——</span>
              <span v-else>{{parseFloat(row.doingQuantity).toFixed(2)}}</span>
            </template>
            <template slot-scope="{ row, index }" slot="waitQuantity">
              <span v-if="row.resourcetype == 1 || row.resourcetype == 3 || row.resourcetype == 4">——</span>
              <span v-else>{{parseFloat(row.waitQuantity).toFixed(2)}}</span>
            </template>
            <template slot-scope="{ row, index }" slot="taskQuantity">
              <span v-if="row.resourcetype == 1 || row.resourcetype == 3 || row.resourcetype == 4">——</span>
              <span v-else>{{row.taskQuantity}}</span>
            </template>
            <template slot-scope="{ row, index }" slot="quantity">
              <template v-if="row.quantity2">
                <span v-if="row.resourcetype == 1 || row.resourcetype == 3 || row.resourcetype == 4">{{row.quantity2 == 1 ? '已分配': '未分配'}}</span>
                <span v-else>{{row.quantity2}}</span>
              </template>
              <template v-else>
                <span v-if="row.resourcetype == 1 || row.resourcetype == 3 || row.resourcetype == 4">{{row.quantity == 1 ? '已分配': '未分配'}}</span>
                <span v-else>{{row.quantity}}</span>
              </template>
            </template>

          </Table>
          </Col>
        </Row>

        <!-- 数据表 -->
        <Row v-if="type === '_09sondata'" style="padding-bottom: 30px">
          <!-- <Row style="padding-bottom: 30px" v-if="!ifedit">
                        <Button type="primary" class="data_button" @click="checkAllDatas">全选</button>
                    </Row> -->
          <CheckboxGroup v-model="checkDatas" v-for="(item,index) in dataInfo.datasList" :key="index">
            <Row>
              <Col span="4" style="width: 140px;padding-bottom: 30px;font-size: 13px;">
              <template v-if="ifedit" style="">
                {{item.tableName}}:
              </template>
              <template v-else-if="item.record != null">
                {{item.tableName}}<span v-if="item.record != null">(已分配)</span><span v-else style="color: rgb(187, 187, 187);">(未分配)</span>:
              </template>
              <Checkbox v-else class="font_seize" :label="item.id" :disabled="ifedit">
                {{item.tableName}}
              </Checkbox>
              </Col>
              <Col span="21" style="width: 86%;padding-bottom: 30px;font-size: 13px;">
              <Row style="font-size:16px;">
                <table class="tale" style="width: 100%;">
                  <tr align="center" class="table_title">
                    <td style="width: 2%;background-color: #F2F2F2; " @click="clicks(index)">
                      <span>
                        <Icon v-if="click && index === clickindex" type="ios-arrow-down" size="16" />
                        <Icon v-else type="ios-arrow-forward" size="16" />
                      </span>
                    </td>
                    <td style="width: 25%;text-align: left;padding-left: 20px;">
                      <FormItem :label="'数据表名称:'" style="margin-bottom: 0px;">
                        <span>{{dataInfo.datasList[index].tableName}}</span>
                      </FormItem>
                    </td>
                  </tr>
                </table>
                <div style=" background-color: #fafafa;" v-if="click && index === clickindex">
                  <div class="form table_width">
                    <Row>
                      <Col span="5">
                      <FormItem label="用途:">
                        <span>{{dataInfo.datasList[index].purpose}}</span>
                      </FormItem>
                      </Col>
                      <Col span="5" style="left: 17.5%;">
                      <FormItem label="表类型：">
                        <span>{{dataInfo.datasList[index].cycleType}}</span>
                      </FormItem>
                      </Col>
                    </Row>
                    <Row>
                      <Col span="22" style="width:100%">
                      <table border="1px" class="tale">
                        <tr align="center" class="tale_title">
                          <template v-for="c in columns.datasColumns">
                            <td>{{c}}</td>
                          </template>
                        </tr>
                        <template v-for="(item, id) in dataInfo.datasList[index].fields">
                          <tr align="center" style="height: 40px;">
                            <td style="width:88.8px;">{{id+1}}</td>
                            <td style="width:132px;">
                              <span>{{dataInfo.datasList[index].fields[id].fieldName}}</span>
                            </td>
                            <td style="width:132px;">
                              <span>{{dataInfo.datasList[index].fields[id].fieldType}}</span>
                            </td>
                            <td style="width:100px;">
                              <span>{{dataInfo.datasList[index].fields[id].isEncryption == 1? "是":"否"}}</span>
                            </td>
                            <td style="width:100px;">
                              <span>{{dataInfo.datasList[index].fields[id].isRequired == 1? "是":"否"}}</span>
                            </td>
                            <td>
                              <span>{{dataInfo.datasList[index].fields[id].remark}}</span>
                            </td>
                          </tr>
                        </template>
                      </table>
                      </Col>

                    </Row>
                  </div>
                </div>

              </Row>
              </Col>
            </Row>
          </CheckboxGroup>
        </Row>

        <!-- 工具 -->
        <Row v-if="(type === '_15sontool' || isEdit == 16 || dataInfo.toolList.length > 0) && dataInfo.toolList.length > 0">
          <Col span="22" style="width:96.57%;padding-bottom: 10px;">
          工具服务：
          </Col>
          <Col span="24" style="width: 96.666667%;padding-bottom: 10px;padding-left: 20px">
          <Row v-for="(item,key) in dataInfo.toolList" :key="key" style="padding-bottom: 10px; ">
            <Col span="12" style="padding-bottom: 10px; ">
            <template v-if="ifedit">
              【工具】{{item.toolName}}
              <span v-if="item.quantity == 1 && item.waitQuantity == 0">(已分配)</span>
              <span v-else-if="item.quantity == 0 && item.waitQuantity == 0" style="color: red;">(分配中)</span>
              <span v-else style="color: rgb(187, 187, 187);">(未分配)</span>
            </template>
            <template v-else-if="item.waitQuantity == 0" class="font_seize" :label="item.id" :disabled="ifedit">
              【工具】{{item.toolName}}
              <span v-if="item.quantity == 1 && item.waitQuantity == 0">(已分配)</span>
              <span v-else-if="item.quantity == 0 && item.waitQuantity == 0" style="color: red;">(分配中)</span>
              <span v-else style="color: rgb(187, 187, 187);">(未分配)</span>
            </template>
            <Checkbox v-else @on-change="chackeTool(item.id)" class="font_seize" :label="item.id" :disabled="ifedit">
              【工具】{{item.toolName}}
            </Checkbox>
            </Col>
            <Col v-if="checkTool.indexOf(item.id) != -1 || ifedit || item.record != null" span="24" style="width: 96.666667%;padding-left: 20px ">
              <template v-if="dataInfo.toolList[key].spServiceType != 'dataEtl' && dataInfo.toolList[key].resourceProgress != null && dataInfo.toolList[key].resourceProgress.length > 0">
                <resourceTable :ifedit="true" v-model="dataInfo.toolList[key].resourceProgress" :handleInfo="true"
                  :columnsList="columns.toolResource"></resourceTable>
              </template>
              <template v-if="dataInfo.toolList[key].severProgress != null && dataInfo.toolList[key].severProgress.length > 0">
                <severModel v-model="dataInfo.toolList[key].severProgress" :ifedit="true" ></severModel>
              </template>
              <template v-if="item.spServiceType == 'openApiPlatform'">
                <open_api_platform_model :key="toolKey" :ifedit="ifedit" v-model="dataInfo.toolList[key]" ></open_api_platform_model>
              </template>
              <template v-if="item.spServiceType == 'dataEtl'">
                <ucx_model :ifedit="ifedit" :isEdit="isEdit" :serviceType="serviceType" v-model="dataInfo.toolList[key]" :key="toolKey" :columnsList="columns.toolResource" ></ucx_model>
              </template>

            </Col>
          </Row>
          </Col>
        </Row>

        <!-- 物理机 -->
        <Row v-if="type === '_05son' || type === '_04son'">
          <Col span="22" style="width:96.57%">
          <CheckboxGroup v-model="checkSever">
            <FormItem label="资源服务：">
              <table border="1px" class="tale">
                <tr align="center" class="tale_title">
                  <td v-if="!ifedit"><span></span></td>
                  <template v-for="(c) in (ifedit?columns.severColumns1:columns.severColumns)">
                    <td>{{c}}</td>
                  </template>
                  <td v-if="!ifedit" style="width: 8%; ">
                    <span>分配数量</span>
                  </td>
                  <td></td>
                </tr>
                <template v-if="dataInfo.severList.length > 0">
                  <tr v-for="(b,index) in dataInfo.severList" :key="index" align="center">
                    <td v-if="!ifedit" align="center" style="width: 8%; ">
                      <Checkbox :label="index" :disabled="b.waitQuantity == 0">
                        <span></span>
                      </Checkbox>
                    </td>
                    <td>
                      <p>{{b.service.severName}}</p>
                    </td>
                    <td>
                      <p>{{b.os}}</p>
                    </td>
                    <td>
                      <p>{{b.sysRaid}}</p>
                    </td>
                    <td>
                      <p>{{b.dataRaid}}</p>
                    </td>
                    <td>
                      <p>{{b.purpose}}</p>
                    </td>
                    <td>
                      <p>{{b.taskQuantity}}</p>
                    </td>
                    <td v-if="ifedit">
                      <p>{{b.quantity}}</p>
                    </td>
                    <td v-if="!ifedit">
                      <p>{{b.doneQuantity}}</p>
                    </td>
                    <td v-if="!ifedit">
                      <p>{{b.doingQuantity}}</p>
                    </td>
                    <td v-if="!ifedit">
                      <p>{{b.waitQuantity}}</p>
                    </td>
                    <td v-if="!ifedit" style="width: 8%; ">
                      <template v-if="b.waitQuantity == 0">已分配完</template>
                      <InputNumber v-else :min="0" :max="b.waitQuantity" style="width: 80%; " class="table_input"
                        v-model="b.quantity2" />
                    </td>
                    <td style="width: 100px; ">
                      <Poptip :transfer="true" placement="top-end">
                        <Button style="margin: 4px;">基础信息</Button>
                        <div slot="title">
                          {{b.service.severName}}
                        </div>
                        <div slot="content">
                          <div slot="content" style="font-size:0;">
                            <p class="p_content">CPU数量: {{b.service.cpuQuantity}}</p>
                            <p class="p_content">CPU型号: {{b.service.cpuDes}}</p>
                            <p class="p_content">网卡数量: {{b.service.ncquantity}}</p>
                            <p class="p_content">网卡型号: {{b.service.ncdes}}</p>
                            <p class="p_content">内存数量: {{b.service.ramQuantity}}</p>
                            <p class="p_content">内存型号: {{b.service.ramDes}}</p>
                            <p class="p_content">数据盘: {{b.service.dataVolumn + b.service.dataUnit}}</p>
                            <p class="p_content">系统盘: {{b.service.sysVolumn + b.service.sysUnit}}</p>
                          </div>
                        </div>
                      </Poptip>
                    </td>
                  </tr>
                </template>
              </table>
            </FormItem>
          </CheckboxGroup>
          </Col>
        </Row>

        <Row v-if="dataInfo.severList.length > 0 && serviceType == 'resource_resourceServer'">
          <Col span="22" style="width:96.57%">
            <FormItem label="资源服务：">
              <table border="1px" class="tale">
                <tr align="center" class="tale_title">
                  <td v-if="!ifedit"><span></span></td>
                  <template v-for="(c) in (ifedit?columns.severColumns1:columns.severColumns)">
                    <td>{{c}}</td>
                  </template>
                  <td v-if="!ifedit" style="width: 8%; ">
                    <span>分配数量</span>
                  </td>
                  <td></td>
                </tr>
                <template v-if="dataInfo.severList.length > 0">
                  <tr v-for="(b,index) in dataInfo.severList" :key="index" align="center">
                    <td v-if="!ifedit" align="center" style="width: 8%; ">
                      <Checkbox :label="index" :disabled="b.waitQuantity == 0">
                        <span></span>
                      </Checkbox>
                    </td>
                    <td>
                      <p>{{b.service.severName}}</p>
                    </td>
                    <td>
                      <p>{{b.os}}</p>
                    </td>
                    <td>
                      <p>{{b.sysRaid}}</p>
                    </td>
                    <td>
                      <p>{{b.dataRaid}}</p>
                    </td>
                    <td>
                      <p>{{b.purpose}}</p>
                    </td>
                    <td>
                      <p>{{b.taskQuantity}}</p>
                    </td>
                    <td v-if="ifedit">
                      <p>{{b.quantity}}</p>
                    </td>
                    <td v-if="!ifedit">
                      <p>{{b.doneQuantity}}</p>
                    </td>
                    <td v-if="!ifedit">
                      <p>{{b.doingQuantity}}</p>
                    </td>
                    <td v-if="!ifedit">
                      <p>{{b.waitQuantity}}</p>
                    </td>
                    <td v-if="!ifedit" style="width: 8%; ">
                      <template v-if="b.waitQuantity == 0">已分配完</template>
                      <InputNumber v-else :min="0" :max="b.waitQuantity" style="width: 80%; " class="table_input"
                        v-model="b.quantity2" />
                    </td>
                    <td style="width: 100px; ">
                      <Poptip :transfer="true" placement="top-end">
                        <Button style="margin: 4px;">基础信息</Button>
                        <div slot="title">
                          {{b.service.severName}}
                        </div>
                        <div slot="content">
                          <div slot="content" style="font-size:0;">
                            <p class="p_content">CPU数量: {{b.service.cpuQuantity}}</p>
                            <p class="p_content">CPU型号: {{b.service.cpuDes}}</p>
                            <p class="p_content">网卡数量: {{b.service.ncquantity}}</p>
                            <p class="p_content">网卡型号: {{b.service.ncdes}}</p>
                            <p class="p_content">内存数量: {{b.service.ramQuantity}}</p>
                            <p class="p_content">内存型号: {{b.service.ramDes}}</p>
                            <p class="p_content">数据盘: {{b.service.dataVolumn + b.service.dataUnit}}</p>
                            <p class="p_content">系统盘: {{b.service.sysVolumn + b.service.sysUnit}}</p>
                          </div>
                        </div>
                      </Poptip>
                    </td>
                  </tr>
                </template>
              </table>
            </FormItem>
          </Col>
        </Row>
        <!-- 账号 -->
        <Row v-if="reqId != null && reqId != '' && type === '_07sonresource' && dataInfo.account != null && !utils.listIsEmpty(dataInfo.account.people)">
          <Col span="22" style="width:96.57%;padding-bottom: 10px;">
          账号信息:
          </Col>
          <Col span="24" style="width: 96.666667%;padding-bottom: 10px;padding-left: 20px">
            <account :Papply="dataInfo" :ifedit="true" :isSon="true"></account>
          </Col>
        </Row>
        <template  v-else-if="reqId != null && reqId != '' && processInfo.content.account != null && processInfo.content.account.people.length > 0 && serviceType == 'resource_resourceSon'">
          <Row>
            <Col span="22" style="width:96.57%;padding-bottom: 10px;">
            账号使用人信息:
            </Col>
            <Col span="24" style="width: 96.666667%;padding-bottom: 10px;padding-left: 20px">
              <template v-if="processInfo.content.account != null && processInfo.content.account.people.length > 0">
                  <usePeople ref="usePeople" v-model="processInfo.content.account.people" :ifedit="true" :peopleList="processInfo.content.account.peopleList" :isShow="true"></usePeople>
              </template>
              <template v-else>
                <div class="gcontent" style="text-align:center">
                  <span style="font-size: 13px;margin-left: 15px;color:#bbb; ">暂无申请人信息</span>
                </div>
              </template>
            </Col>
          </Row>
          <Row >
            <Col span="22" style="width:96.57%;padding-bottom: 10px;">
            账号信息:
            </Col>
            <Col span="24" style="padding-bottom: 10px;padding-left: 20px">
              <component ref="account" :is="'account'" v-model="newAccount" :key="accountKey" :dataInfo="dataInfo" :isEdit="false" :isShow="true" :ifedit="ifedit" :isSon="true"
                style="margin-left: 20px;"></component>
            </Col>
          </Row>
        </template>

        <Row>
          <Col span="22" style="width:96.57%">
          <FormItem label="分配描述:" prop="reqDes">
            <Input v-model="childrenInfo.reqDes" :readonly="ifedit" placeholder="请描述申请原因及用途" type="textarea" :autosize="{minRows: 4,maxRows: 6}" />
          </FormItem>
          </Col>
        </Row>


        <!-- 附件 -->
        <template>
          <div class="qheader" :style="{borderBottom: '0px solid rgb(210,210,210)',}">
            <p>附件</p>
          </div>
          <component ref="file" :is="'file'" :ifedit="ifedit" :filesList="filesList" v-model="childrenInfo.files"></component>
        </template>
      </Form>
    </div>
  </div>
</template>

<script>
  import account from './settledin_test/accounttemplate.vue'
  import ajax from "../../ajax_util"
  import Axios from 'axios'
  import resourceTable from "../../base/tables"
  import file from './settledin/file'
  import open_api_platform_model from './apply_model/open_api_platform_model/open_api_platform.vue'
  import severModel from './apply_model/server_model.vue'
  import ucx_model from "./apply_model/ucx_model/ucx.vue"
  import usePeople from './settledin_test/usePeople.vue'

  export default {
    name: "children_page",
    components: {
      resourceTable,
      account,
      file,open_api_platform_model,severModel,ucx_model,usePeople
    },
    data() {
      return {
        newAccount:[],
        account:[],
        accountKey: 0,
        toolKey: 0,
        type: this.childrenType,
        // ifedit: this.isedit,
        showFileMould: false,
        httpHeader: {
          Authorization: this.$store.state.token
        },
        //选择工具
        checkTool: [],
        tools2: [], //选择的工具关联资源
        //选择的数据表
        checkDatas: [],
        click: true,
        clickindex: "",
        checkSever: [], //选择物理机分配

        fileUrl: this.CONFIG.file_url,
        columns: {
          resourceColumns: [{
              type: 'selection',
              minWidth: 60,
              align: 'center',
            },
            {
              title: "资源类型",
              align: "center",
              minWidth: 90,
              key: "clazz",
              slot: "clazz",
            },
            {
              title: "服务名称",
              align: "center",
              minWidth: 90,
              key: "serviceName",
              slot: "serviceName",
            },
            {
              title: "细分项名",
              align: "center",
              minWidth: 90,
              key: "subName",
              slot: "subName",
            },
            {
              title: '测算依据',
              key: 'purpose',
              align: 'center',
              minWidth: 200,
            },
            {
              title: "可选项",
              align: "center",
              minWidth: 300,
              slot: "options"
            },
            {
              title: "已分配数量",
              align: "center",
              width: 70,
              key: "doneQuantity",
              slot: "doneQuantity"
            },
            {
              title: "正在分配数量",
              align: "center",
              width: 70,
              key: "doingQuantity",
              slot: "doingQuantity",
            },
            {
              title: "待分配数量",
              align: "center",
              width: 70,
              key: "waitQuantity",
              slot: "waitQuantity"
            },
            {
              title: "分配数量",
              align: "center",
              width: 100,
              key: "quantity2",
              slot: "quantity2"
            },

          ],
          resourceColumns1: [{
              title: "资源类型",
              align: "center",
              minWidth: 90,
              key: "clazz",
              slot: "clazz",
            },
            {
              title: "服务名称",
              align: "center",
              minWidth: 90,
              key: "serviceName",
              slot: "serviceName",
            },
            {
              title: "细分项名",
              align: "center",
              minWidth: 90,
              key: "subName",
              slot: "subName",
            },
            {
              title: "可选项",
              align: "center",
              minWidth: 300,
              key: "options",
              slot: "options"
            },
            {
              title: '测算依据',
              key: 'purpose',
              align: 'center',
              minWidth: 150,
            },
            {
              title: "需要数量",
              align: "center",
              width: 80,
              key: "taskQuantity",
              slot: "taskQuantity"
            },
            {
              title: "实际分配数量",
              align: "center",
              width: 80,
              key: "quantity",
              slot: "quantity"
            },


          ],
          severColumns: ["服务类型", "操作系统", 'raid方式/系统盘', 'raid方式/数据盘',
            "测算依据/必要性说明", "需求数量", "已分配数量", "正在分配数量",
            "待分配数量"
          ],
          severColumns1: ["服务类型", "操作系统", 'raid方式/系统盘', 'raid方式/数据盘',
            "测算依据/必要性说明", "分配数量", "实际分配数量"
          ],
          toolColumns: [{
              title: "资源类型",
              align: "center",
              // width: 110,
              key: "clazz",
            },
            {
              title: "服务名称",
              align: "center",
              // width: 120,
              key: "serviceName",
            },
            {
              title: "细分项名",
              align: "center",
              // width: 100,
              key: "subName",
            },
            {
              title: "单位",
              align: "center",
              width: 80,
              key: "unit",
            },
            {
              title: '测算依据',
              key: 'purpose',
              align: 'center',
            },
            {
              title: "需求数量",
              align: "center",
              width: 80,
              key: "quantity",
            },
            {
              title: "已分配数量",
              align: "center",
              width: 80,
              key: "doneQuantity",
            },
            {
              title: "正在分配数量",
              align: "center",
              width: 80,
              key: "doingQuantity",
            },
            {
              title: "待分配数量",
              align: "center",
              width: 80,
              key: "waitQuantity",
            },
          ],
          datasColumns: [
            "序号",
            "字段名",
            "字段类型",
            "是否加密",
            "是否必填",
            "备注"
          ],
          toolResource: [{
              title: "资源类型",
              align: "center",
              width: 110,
              key: "clazz",
              slot: "clazz",
              fixed: 'left'
            },
            {
              title: "服务名称",
              align: "center",
              width: 110,
              key: "serviceName",
              slot: "serviceName",
            },
            {
              title: "细分项名",
              align: "center",
              width: 100,
              key: "subName",
              slot: "subName",
            },
            {
              title: '测算依据',
              key: 'purpose',
              minWidth: 140,
              align: 'center',
            },
            {
              title: "可选项",
              align: "center",
              minWidth: 300,
              slot: "options"
            },
            {
              title: "已分配数量",
              align: "center",
              width: 80,
              key: "doneQuantity",
              slot: "doneQuantity"
            },
            {
              title: "正在分配数量",
              align: "center",
              width: 80,
              key: "doingQuantity",
              slot: "doingQuantity"
            },
            {
              title: "待分配数量",
              align: "center",
              width: 80,
              key: "waitQuantity",
              slot: "waitQuantity"
            },
          ]
        },
        checkList: [], //选择需要分配的资源
        labelWidth: 140,
        childrenValidate: {
          reqSubject: [{
            required: true,
            type: 'string',
            message: '请填写需求主题',
            trigger: 'blur'
          }, {
            type: 'string',
            max: 50,
            message: '最多填写50个字符',
            trigger: 'blur'
          }, ],
          reqDes: [{
            required: true,
            type: 'string',
            message: '请填写需求描述',
            trigger: 'change'
          }, ],
        },
        dataInfo: {
          account: [],
          resourceList: [],
          severList: [],
          datasList: [],
          toolList: []
        },
        childrenInfo: {
          records: [], //分配情况
          reqDes: "", //需求描述
          files: [],
          reqSubject: ""
        },
        g_span_record_obj: {
          "resource": {}
        },
        g_hash_record: {},
        applyinfo:{
          account:[]
        }
      }
    },
    mounted: function() {
      console.log("this.reqId,this.draftsId,children---------->", this.reqId, this.draftsId, this.children, this.childrenType)
      if (this.reqId != null) {
        this.reqId = this.reqId
        this.getApplyInfo(); //获取表单详情
      } else if (this.draftsId != null) {
        this.getDrafts()
      } else if (this.children != null) {
        this.getResourceInfo()
      }
    },
    methods: {
      handleSpan({
      	row,
      	column,
      	rowIndex,
      	columnIndex
      }) {
        if (column.slot === "clazz") {
        	return {
        		rowspan: row.mergeCol === 0 ? 0 : row.mergeCol,
        		colspan: row.mergeCol === 0 ? 0 : 1
        	};
        }else if (column.slot === "serviceName") {
        	// console.log(row,column,rowIndex, columnIndex)
        	return {
        		rowspan: row.mergeCol1 === 0 ? 0 : row.mergeCol1,
        		colspan: row.mergeCol1 === 0 ? 0 : 1
        	};
        }else if (column.slot === "subName") {
        	// console.log(row,column,rowIndex, columnIndex)
        	return {
        		rowspan: row.mergeCol2 === 0 ? 0 : row.mergeCol2,
        		colspan: row.mergeCol2 === 0 ? 0 : 1
        	};
        }
      },
      setSortData(data) {
      	var t = JSON.stringify(data)
      	var t2 = JSON.parse(t)
        console.log("t2 = ", JSON.stringify(t2))
      	var res = t2.sort((a, b) => {
      		let i = a['clazz'].localeCompare(b['clazz'])
      		if (i == 0) {
      			let i2 = a['serviceName'].localeCompare(b['serviceName'])
      			if (i2 == 0) {
      				return a['subName'].localeCompare(b['subName'])
      			}else {
      				return i2
      			}
      		} else {
      			return i
      		}
      	})
      	if (res.length > 0) {
      		let that = this;
      		let arrId = [];
      		let serviceNameArr = [];
      		let subNameArr = [];
      		res.forEach(i => {
      			!arrId.includes(i.clazz) ? arrId.push(i.clazz) : arrId;
      			!serviceNameArr.includes(i.serviceName) ? serviceNameArr.push(i.serviceName) : arrId;
      			!subNameArr.includes(i.subName) ? subNameArr.push(i.subName) : arrId;
      		});
      		let arrObj = [];
      		let serviceNameObj = [];
      		let subNameObj = [];
      		arrId.forEach(j => {
      			arrObj.push({
      				id: j,
      				num: 0
      			})
      		})
      		serviceNameArr.forEach(j => {
      			serviceNameObj.push({
      				id: j,
      				num: 0
      			})
      		})
      		subNameArr.forEach(j => {
      			subNameObj.push({
      				id: j,
      				num: 0
      			})
      		})
      		console.log("arrId----->", arrId, arrObj)
      		res.forEach(k => {
      			arrObj.forEach(l => {
      				k.clazz === l.id ? l.num++ : l.num;
      			})
      			serviceNameObj.forEach(l => {
      				k.serviceName === l.id ? l.num++ : l.num;
      			})
      			subNameObj.forEach(l => {
      				k.subName === l.id ? l.num++ : l.num;
      			})
      		})
      		res.forEach(m => {
      			arrObj.forEach((n, index) => {
      				if (m.clazz === n.id) {
      					if (arrId.includes(m.clazz)) {
      						m.mergeCol = n.num;
      						arrId.splice(arrId.indexOf(m.clazz), 1);
      					} else {
      						m.mergeCol = 0;
      					}
      				}
      			})
      			serviceNameObj.forEach((n, index) => {
      				if (m.serviceName === n.id) {
      					if (serviceNameArr.includes(m.serviceName)) {
      						m.mergeCol1 = n.num;
      						serviceNameArr.splice(serviceNameArr.indexOf(m.serviceName), 1);
      					} else {
      						m.mergeCol1 = 0;
      					}
      				}
      			})
      			subNameObj.forEach((n, index) => {
      				if (m.subName === n.id) {
      					if (subNameArr.includes(m.subName)) {
      						m.mergeCol2 = n.num;
      						subNameArr.splice(subNameArr.indexOf(m.subName), 1);
      					} else {
      						m.mergeCol2 = 0;
      					}
      				}
      			})
      		})
      	}

      	return res;
      },

      getSortName(nameStr) {
        var baseNum = 10000;
        var sp = nameStr.split(".");
        var res = 0
        if (sp.length > 1) {
          res = Number(sp[0]);
        } else {
          if (this.objContain(this.g_hash_record, nameStr)) {
            res = this.g_hash_record[nameStr];
          } else {
            var rand = this.randomNum(1000, 2000);
            this.g_hash_record[nameStr] = rand;
            res = rand;
          }

        }
        // console.log(res,nameStr)
        return res;

      },

      getRealName(nameStr) {

        var sp = nameStr.split(".");
        if (sp.length > 1) {
          return sp[1];
        } else {
          return nameStr;

        }

      },

      setUpandDown(obj, key, inp) {
        if (!this.objContain(obj, key)) {
          obj[key] = {
            "up": inp,
            "down": inp
          }
        }
        if (obj[key]["up"] < inp) {
          obj[key]["up"] = inp
        }
        if (obj[key]["down"] > inp) {
          obj[key]["down"] = inp
        }
      },

      objContain(obj, key) {
        // console.log(obj,key)
        for (var k in obj) {
          if (key == k) {
            return true
          }
        }
        return false;
      },

      randomNum(minNum, maxNum) {
        switch (arguments.length) {
          case 1:
            return parseInt(Math.random() * minNum + 1, 10);
            break;
          case 2:
            return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
            //或者 Math.floor(Math.random()*( maxNum - minNum + 1 ) + minNum );
            break;
          default:
            return 0;
            break;
        }
      },


      // 获取相关分配资源
      getResourceInfo() {
        if (this.isEdit == 16) {
          this.handleResource_16()
        } else {
          this.handleResource()
        }
      },
      handleResource_16() {
        var data = this.resourceInfo
        console.log("getResourceInfo----->", JSON.stringify(data))
        this.childrenInfo.reqSubject = "资源、工具分配子工单"

        this.dataInfo.resourceList = this.setSortData(data.resourceList)
        this.dataInfo.resourceList.forEach((item, index) => {
          console.log("-item-------", item)
          this.dataInfo.resourceList[index].quantity2 = item.waitQuantity
          if (item.waitQuantity == 0) {
            this.dataInfo.resourceList[index]._disabled = true
          }
          if (item.resourcetype == 4 && typeof item.val == 'string') {
            this.dataInfo.resourceList[index].quotaValue = JSON.parse(item.val)
            this.dataInfo.resourceList[index].val = JSON.parse(item.val)
          }
        })

        this.dataInfo.toolList = data.toolList
        this.dataInfo.toolList.forEach((item, index) => {
          if (item.resourceProgress != null) {
            item.resourceProgress.forEach((i, k) => {
              if (i.resourcetype == 4 && typeof i.val === 'string') {
                console.log(i)
                this.dataInfo.toolList[index].resourceProgress[k].quotaValue = JSON.parse(i.val)
                this.dataInfo.toolList[index].resourceProgress[k].val = JSON.parse(i.val)
              }
              i.quantity2 = i.waitQuantity
            })
          }
        })
      },
      handleResource() {
        var data = this.resourceInfo
        console.log("getResourceInfo----->", JSON.stringify(data))

        if (this.childrenType === '_07sonresource') { //资源
          this.dataInfo.resourceList = this.setSortData(data)
          this.childrenInfo.reqSubject = "资源分配子工单"
          this.dataInfo.resourceList.forEach((item, index) => {
            console.log("-item-------", item)
            this.dataInfo.resourceList[index].quantity2 = item.waitQuantity
            if (item.waitQuantity == 0) {
              this.dataInfo.resourceList[index]._disabled = true
            }
            if (item.resourcetype == 4 && typeof item.val == 'string') {
              this.dataInfo.resourceList[index].quotaValue = JSON.parse(item.val)
              this.dataInfo.resourceList[index].val = JSON.parse(item.val)
            }
          })

        } else if (this.childrenType === '_09sondata') { //数据
          this.childrenInfo.reqSubject = "数据资源分配子工单"
          this.dataInfo.datasList = data
        } else if (this.childrenType === '_15sontool') { //工具
          this.childrenInfo.reqSubject = "工具资源分配子工单"
          this.dataInfo.toolList = data
          this.dataInfo.toolList.forEach((item, index) => {
            if (item.resourceProgress != null) {
              item.resourceProgress.forEach((i, k) => {
                if (i.resourcetype == 4 && typeof i.val == 'string') {
                  console.log(i)
                  this.dataInfo.toolList[index].resourceProgress[k].quotaValue = JSON.parse(i.val)
                  this.dataInfo.toolList[index].resourceProgress[k].val = JSON.parse(i.val)
                }
                i.quantity2 = i.waitQuantity
              })
            }
          })
        } else if (this.childrenType === '_05son' || this.childrenType === '_04son') { //物理机
          this.childrenInfo.reqSubject = "物理机资源分配子工单"
          this.dataInfo.severList = data
          this.dataInfo.severList.forEach((item, index) => {
            item.quantity2 = item.waitQuantity
          })
        }
      },
      //获取草稿
      getDrafts() {
        var url = this.CONFIG.base_url_test + "/draft/content/" + this.draftsId
        var that = this;
        ajax.get({
          url: url,
          that: that,
          params: null,
          success: function(data) {
            if (data.req.reqSubject === undefined) {
              that.childrenInfo.reqSubject = data.req.overview.reqSubject
              that.childrenInfo.reqDes = data.req.overview.reqDes
              that.childrenInfo.files = data.req.files
            } else {
              that.childrenInfo = data.req
            }
          }
        })
      },
      //获取申请信息
      getApplyInfo() {
        console.log("获取 ----> ", JSON.stringify(this.processInfo),this.dataInfo)
        var data = this.processInfo.content
        if (this.processInfo.files != undefined && this.processInfo.files != null) {
          this.childrenInfo.files = this.processInfo.files
        }
        this.childrenInfo.reqSubject = this.processInfo.reqSubject
        this.childrenInfo.reqDes = this.processInfo.reqDes
        if(this.serviceType == 'resource_openApiPlatform' || this.serviceType == 'resource_dataEtl'
          || this.serviceType == 'resource_resourceSon' || this.serviceType == 'resource_resourceServer'){
            console.log("获取 ----> ", )
          this.dataInfo.resourceList = this.setSortData(data.resources)
          //处理资源
          this.dataInfo.resourceList.forEach((item, index) => {
            console.log()
            if (item.resourcetype == 4 && typeof item.val == "string") {
              this.dataInfo.resourceList[index].quotaValue = JSON.parse(item.val)
              this.dataInfo.resourceList[index].val = JSON.parse(item.val)
            }
          })
          this.dataInfo.toolList = data.tools
          //处理工具
          this.dataInfo.toolList.forEach((item, index) => {
            if (item.resourceProgress) {
              item.resourceProgress.forEach((i, k) => {
                if (i.resourcetype == 4 && typeof i.val == "string") {
                  this.dataInfo.toolList[index].resourceProgress[k].quotaValue = JSON.parse(i.val)
                  this.dataInfo.toolList[index].resourceProgress[k].val = JSON.parse(i.val)
                } else {
                  this.dataInfo.toolList[index].resourceProgress[k].quotaValue = i.val
                }
                this.dataInfo.toolList[index].resourceProgress[k].quotaUnit = i.unit
              })
            }
            if (item.spServiceType == "openApiPlatform") {
              this.getDetail(item, 'openApiPlatform')
            }
            if (item.spServiceType == "dataEtl") {
              this.getDetail(item, 'dataEtl')
            }
          })

          this.dataInfo.datasList = data.datas
          this.dataInfo.severList = JSON.parse(JSON.stringify(data.severs))

          if (this.processInfo.content.account) {
            this.dataInfo.account = {
              people: [],
              peopleList: []
            }
            this.processInfo.content.account.people.forEach(item => {
              if (item.peopleName != '') {
                if (item.hftps.length > 0) {
                  for (var j = 0; j < item.hftps.length; j++) {
                    if (item.hftps[j].isCluster) {
                      item.isEtl = true;
                    }

                    if (item.hftps[j].isClient) {
                      item.isUap = true;
                    }
                  }
                }

                if (item.paas.length > 0) {
                  item.isPaas = true;
                }

                if (item.hadoops.length > 0) {
                  item.isHadoop = true;
                }

                if (item.elseAuthes.length > 0) {
                  item.isElse = true;
                }
                this.dataInfo.account.people.push(item)
                var j = {
                  id: "",
                  user_name: "",
                  fourA: "",
                  structs: []
                }
                if (item.peopleUserId != undefined && item.peopleUserId != null &&
                  typeof item.peopleUserId == 'number' && item.peopleUserId != 0) {
                  j.id = item.peopleUserId;
                } else {
                  item.peopleUserId = item.peopleName;
                  j.id = item.peopleName;
                }
                j.fourA = item.fourA
                j.user_name = item.peopleName;
                this.dataInfo.account.peopleList.push(j);
              }
            })
            this.account = this.dataInfo.account
           this.accountKey = new Date().getTime()
          }
          this.$forceUpdate()
        }else{
          //历史工单
          if (data.resources.length > 0 && data.tools.length > 0) {
            this.isEdit = 16
            this.type = "_07sonresource"
            this.dataInfo.resourceList = this.setSortData(data.resources)
            this.dataInfo.resourceList.forEach((item, index) => {
              if (item.resourcetype == 4 && typeof item.val == "string") {
                this.dataInfo.resourceList[index].quotaValue = JSON.parse(item.val)
                this.dataInfo.resourceList[index].val = JSON.parse(item.val)
              }
            })
            if (this.processInfo.content.account != undefined && this.processInfo.content.account != null) {
              this.dataInfo.account = {
                people: [],
                peopleList: []
              }
              this.processInfo.content.account.people.forEach(item => {
                if (item.peopleName != '') {
                  if (item.hftps.length > 0) {
                    for (var j = 0; j < item.hftps.length; j++) {
                      if (item.hftps[j].isCluster) {
                        item.isEtl = true;
                      }

                      if (item.hftps[j].isClient) {
                        item.isUap = true;
                      }
                    }
                  }

                  if (item.paas.length > 0) {
                    item.isPaas = true;
                  }

                  if (item.hadoops.length > 0) {
                    item.isHadoop = true;
                  }

                  if (item.elseAuthes.length > 0) {
                    item.isElse = true;
                  }
                  this.dataInfo.account.people.push(item)
                  var j = {
                    id: "",
                    user_name: "",
                    fourA: "",
                    structs: []
                  }
                  if (item.peopleUserId != undefined && item.peopleUserId != null &&
                    typeof item.peopleUserId == 'number' && item.peopleUserId != 0) {
                    j.id = item.peopleUserId;
                  } else {
                    item.peopleUserId = item.peopleName;
                    j.id = item.peopleName;
                  }
                  j.fourA = item.fourA
                  j.user_name = item.peopleName;
                  this.dataInfo.account.peopleList.push(j);
                }
              })
            }
            this.dataInfo.toolList = data.tools
            this.dataInfo.toolList.forEach((item, index) => {
              if (item.resourceProgress != null && item.resourceProgress.length > 0) {
                item.resourceProgress.forEach((i, k) => {
                  if (i.resourcetype == 4 && typeof i.val === 'string') {
                    console.log(i)
                    this.dataInfo.toolList[index].resourceProgress[k].quotaValue = JSON.parse(i.val)
                    this.dataInfo.toolList[index].resourceProgress[k].val = JSON.parse(i.val)
                  } else {
                    this.dataInfo.toolList[index].resourceProgress[k].quotaValue = i.val
                  }
                  this.dataInfo.toolList[index].resourceProgress[k].quotaUnit = i.unit
                })
              }
            })
          } else if (data.resources.length > 0) {
            this.type = "_07sonresource"
            this.dataInfo.resourceList = this.setSortData(data.resources)
            this.dataInfo.resourceList.forEach((item, index) => {
              if (item.resourcetype == 4 && typeof item.val == "string") {
                this.dataInfo.resourceList[index].quotaValue = JSON.parse(item.val)
                this.dataInfo.resourceList[index].val = JSON.parse(item.val)
              }
            })
            if (this.processInfo.content.account != undefined && this.processInfo.content.account != null) {
              this.dataInfo.account = {
                people: [],
                peopleList: []
              }
              this.processInfo.content.account.people.forEach(item => {
                if (item.peopleName != '') {
                  if (item.hftps.length > 0) {
                    for (var j = 0; j < item.hftps.length; j++) {
                      if (item.hftps[j].isCluster) {
                        item.isEtl = true;
                      }

                      if (item.hftps[j].isClient) {
                        item.isUap = true;
                      }
                    }
                  }

                  if (item.paas.length > 0) {
                    item.isPaas = true;
                  }

                  if (item.hadoops.length > 0) {
                    item.isHadoop = true;
                  }

                  if (item.elseAuthes.length > 0) {
                    item.isElse = true;
                  }
                  this.dataInfo.account.people.push(item)
                  var j = {
                    id: "",
                    user_name: "",
                    fourA: "",
                    structs: []
                  }
                  if (item.peopleUserId != undefined && item.peopleUserId != null &&
                    typeof item.peopleUserId == 'number' && item.peopleUserId != 0) {
                    j.id = item.peopleUserId;
                  } else {
                    item.peopleUserId = item.peopleName;
                    j.id = item.peopleName;
                  }
                  j.fourA = item.fourA
                  j.user_name = item.peopleName;
                  this.dataInfo.account.peopleList.push(j);
                }
              })
            }

          } else if (data.datas.length > 0) {
            this.type = "_09sondata"
            console.log("-------asdasd")
            this.dataInfo.datasList = data.datas
          }
          if (data.tools.length > 0) {
            this.type = "_15sontool"
            this.dataInfo.toolList = data.tools
            this.dataInfo.toolList.forEach((item, index) => {
              if (item.resourceProgress) {
                item.resourceProgress.forEach((i, k) => {
                  if (i.resourcetype == 4 && typeof i.val == "string") {
                    this.dataInfo.toolList[index].resourceProgress[k].quotaValue = JSON.parse(i.val)
                    this.dataInfo.toolList[index].resourceProgress[k].val = JSON.parse(i.val)
                  } else {
                    this.dataInfo.toolList[index].resourceProgress[k].quotaValue = i.val
                  }
                  this.dataInfo.toolList[index].resourceProgress[k].quotaUnit = i.unit
                })
              }
              if (item.spServiceType == "openApiPlatform") {
                this.getDetail(item, 'openApiPlatform')
              }
              if (item.spServiceType == "dataEtl") {
                this.getDetail(item, 'dataEtl')
              }
            })
          } else if (data.severs.length > 0) {
            this.type = "_05son"
            this.dataInfo.severList = data.severs
          }
        }


        this.$forceUpdate()
        // that.childrenInfo.reqDes = data.content.overview.reqDes
      },
      /**
       * 获取openApiPlatform工具的api详情
       * @param {Object} item
       */
      async getDetail(item, type) {
        var param = {
          spServiceType: item.spServiceType,
          alloId: item.id
        }
        var that = this
        await this.myAjax.get({
          url: this.CONFIG.progress_url + "/sp-list/detail",
          that: that,
          params: param,
          success: function(data) {
            if(type == 'openApiPlatform'){
              if(data.hasAccount){
                data.hasAccount = 1
              }else{
                data.hasAccount = 0
              }
            }
            if(type == 'dataEtl'){
              data.actTime = that.formatTime(data.actTime)
              if(data.ifNeedPublicData == 1 ){
                data.ifNeedPublicData = true
              }else {
                data.ifNeedPublicData = false
              }
              if(data.ifNeedPrivateData == 1 ){
                data.ifNeedPrivateData = true
              }else {
                data.ifNeedPrivateData = false
              }
              data.privateTransmisMode = JSON.parse(data.privateTransmisMode)
              data.publicTransmisMode = JSON.parse(data.publicTransmisMode)
            }
            that.$set(item, "spContent", data)
            console.log("item ---》", item)
            that.toolKey = new Date().getTime()
          },
        })
      },
      //提交时整理获取表单信息
      getInfo() {
        this.validate()
        var publicInfo = this.utils.setPublicInfoInfo(this.childrenInfo.reqSubject, 0, 0, this.childrenInfo.reqDes)
        this.childrenInfo.object = this.childrenInfo.records
        this.childrenInfo.puslicInfo = publicInfo
        return this.childrenInfo
      },

      // 获取处理时需要提交的参数
      getHandleParams(handleInfo) {
        handleInfo.reqSubject = this.childrenInfo.reqSubject
        handleInfo.startTime = 0
        handleInfo.hopeTime = 0
        handleInfo.reqDes = this.childrenInfo.reqDes
        handleInfo.isEdit = this.isEdit;
        console.log("aaaa-------->", this.ifedit, this.isEdit == 1)
        handleInfo.isChangeContent = 0;
        if (!this.ifedit) {
          handleInfo.isChangeContent = 1;
        }
        if (this.isEdit == 1) {
          handleInfo.isChangeContent = 1;
          handleInfo.content = this.getInfo()
        }
      },
      //处理页面获取下一步处理人需要的参数
      getHandleUserParams(opOptions) {
        var param = {}
        if (opOptions != "") {
          param.vari = opOptions
        }
        return param
      },

      //设置需要提交的资源信息
      setRecords() {
        var isInfo = false
        var records = []
        if (this.isEdit == 16) {
          records = {
            resource: [],
            tools: []
          }
          this.dataInfo.resourceList.forEach(item => {
            if (this.checkList.indexOf(item.id) != -1 && item.quantity2 != 0) {
              records.resource.push({
                serviceId: item.serviceId,
                unit: item.unit,
                alloId: item.id,
                taskQuantity: item.quantity2
              })
            }
          })

          this.dataInfo.toolList.forEach((item, index) => {
            if (this.checkTool.indexOf(item.id) != -1) {
              records.tools.push({
                alloId: item.id,
                serviceId: item.toolId,
              })
            }
          })
          this.childrenInfo.records = records
          if (records.resource.length > 0 || records.tools.length > 0) {
            return true
          }
        } else if (this.type === '_07sonresource') { //资源
          this.dataInfo.resourceList.forEach(item => {
            if (this.checkList.indexOf(item.id) != -1 && item.quantity2 != 0) {
              records.push({
                serviceId: item.serviceId,
                unit: item.unit,
                alloId: item.id,
                taskQuantity: item.quantity2
              })
            }
          })
        } else if (this.type === '_15sontool') { //工具
          this.dataInfo.toolList.forEach((item, index) => {
            if (this.checkTool.indexOf(item.id) != -1) {
              records.push({
                alloId: item.id,
                serviceId: item.toolId,
              })
            }

          })
        } else if (this.type === '_09sondata') { //数据表
          this.dataInfo.datasList.forEach((item, index) => {
            if (this.checkDatas.indexOf(item.id) != -1) {
              records.push({
                alloId: item.id,
              })
            }
          })
        } else if (this.type === '_05son' || this.type === '_04son') { // 物理机
          this.dataInfo.severList.forEach((item, index) => {
            if (this.checkSever.indexOf(index) != -1) {
              records.push({
                alloId: item.id,
                taskQuantity: item.quantity2,
                serviceId: item.severId
              })
            }
          })
        }
        this.childrenInfo.records = records
        if (this.childrenInfo.records.length > 0) {
          isInfo = true
        }
        return isInfo;
      },
      //校验表单数据
      validate() {
        var isSubmit = false
        this.$refs["childrenInfo"].validate((valid) => {
          if (valid) {
            var b = this.setRecords()
            if (b) {
              isSubmit = true
            } else {
              this.$parent.showSubmint = false
              this.$Message.error('请选择可分配资源！');
            }
          } else {
            this.$parent.showSubmint = false
            this.$Message.error('请填写必填项');
          }
        })
        return isSubmit
      },
      //设置选择的所有资源数据
      checkResourceList(selection) {
        this.checkList = []
        selection.forEach(item => {
          this.checkList.push(item.id)
        })
      },
      //选择所有数据表
      checkAllDatas() {
        this.dataInfo.datasList.forEach(item => {
          if (this.checkDatas.indexOf(item.id) == -1) {
            this.checkDatas.push(item.id)
          }
        })
      },
      // 选择工具
      chackeTool(id) {
        if (this.checkTool.indexOf(id) == -1) {
          this.checkTool.push(id)
        } else(
          this.checkTool.splice(this.checkTool.indexOf(id), 1)
        )
      },

      clicks(index) {
        if (this.clickindex === index) {
          if (this.click) {
            this.click = false
          } else {
            this.click = true
          }
        } else {
          if (!this.click) {
            this.click = true
          }
        }
        this.clickindex = index;
      },
      formatTime(value) {
        return this.utils.formatDate(new Date(value * 1000), "yyyy-MM-dd")
      },

    },

    props: {
      isEdit: {},
      ifedit: {
        type: Boolean,
        default: false,
      },
      reqId: {
        default: null
      },
      draftsId: {
        default: null
      },
      serviceType: {
        default: null
      },
      childrenType: {
        default: null
      },
      children: {
        default: null
      },
      filesList: {},
      processInfo: {},
      resourceInfo: {},
    },
    // computed:{
    //     isEdit(){
    //         return this.$store.state.tabs != undefined && this.$store.state.tabs!=null? this.$store.state.tabs.isEdit:""
    //     }
    // },
    // watch:{
    //     isEdit(Val){
    //         if((Val + '') === (this.reqId + '')){
    //             this.ifedit = false
    //         }else{
    //             this.ifedit = true
    //         }
    //     }
    // }
  }
</script>
